package com.chinaunicom.structure.flyweight;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/8/10 15:02
 * Description:
 */
public class Forest {
    
    private List<Tree> treeList = new ArrayList<>();
    
    public void plant(String locationX, String locationY, String name, String color, String texture){
        TreeType treeType = TreeFactory.createTree(name, color, texture);
        // 创建 Tree
        Tree tree = new Tree(locationX, locationY, treeType);
        
        treeList.add(tree);
    }
    
    
    
    public void draw() {
        treeList.forEach(v->{
            v.draw();
        });
    }
    
    
}
